// AESManager.ts
import CryptoJS from 'crypto-js'

class AESManager {
  private key: string

  constructor(key: string) {
    this.key = key
  }

  encrypt(data: string): string {
    const encrypted = CryptoJS.AES.encrypt(data, this.key).toString()
    return encrypted
  }

  decrypt(encryptedData: string): string {
    const bytes = CryptoJS.AES.decrypt(encryptedData, this.key)
    const originalData = bytes.toString(CryptoJS.enc.Utf8)
    return originalData
  }
}

export default AESManager
